﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YunShop_WebAPI.Model
{
    /// <summary>
    /// 结果类
    /// 
    /// </summary>
    public class Result_Model
    {
        private int _Status;
        private string _Message;
        private object _Data;
        private int _Count;
        private int _Page_Count;

        /// <summary>
        /// 状态[0-接口异常,1-成功,2-失败]
        /// </summary>
        public int Status { get { return _Status; } set { _Status = value; } }
        /// <summary>
        /// 消息
        /// </summary>
        public string Message { get { return _Message; } set { _Message = value; } }
        /// <summary>
        /// 数据
        /// </summary>
        public object Data { get { return _Data; } set { _Data = value; } }
        /// <summary>
        /// 条数
        /// </summary>
        public int Count { get { return _Count; } set { _Count = value; } }
        /// <summary>
        /// 总页数
        /// </summary>
        public int Page_Count { get { return _Page_Count; } set { _Page_Count = value; } }

        /// <summary>
        /// 初始化
        /// </summary>
        public Result_Model() { }

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="_status">状态[0-接口异常,1-成功,2-失败]</param>
        /// <param name="_message">消息</param>
        public Result_Model(int _status, string _message)
        {
            this.Status = _status;
            this.Message = _message;
        }

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="_status">状态[0-接口异常,1-成功,2-失败]</param>
        /// <param name="_message">消息</param>
        /// <param name="_data">数据</param>
        public Result_Model(int _status, string _message, object _data)
        {
            this.Status = _status;
            this.Message = _message;
            this.Data = _data;
        }

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="_status">状态[0-接口异常,1-成功,2-失败]</param>
        /// <param name="_message">消息</param>
        /// <param name="_data">数据</param>
        /// <param name="_count">条数</param>
        public Result_Model(int _status, string _message, object _data, int _count)
        {
            this.Status = _status;
            this.Message = _message;
            this.Data = _data;
            this.Count = _count;
        }

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="_status">状态[0-接口异常,1-成功,2-失败]</param>
        /// <param name="_message">消息</param>
        /// <param name="_data">数据</param>
        /// <param name="_count">条数</param>
        public Result_Model(int _status, string _message, ArrayList _data, int _count)
        {
            this.Status = _status;
            this.Message = _message;
            this.Data = _data;
            this.Count = _count;
        }

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="_status">状态[0-接口异常,1-成功,2-失败]</param>
        /// <param name="_message">消息</param>
        /// <param name="_data">数据</param>
        /// <param name="_count">条数</param>
        /// <param name="_page_count">总页数</param>
        public Result_Model(int _status, string _message, object _data, int _count, int _page_count)
        {
            this.Status = _status;
            this.Message = _message;
            this.Data = _data;
            this.Count = _count;
            this._Page_Count = _page_count;
        }
    }

    /// <summary>
    /// 微信接口返回数据结果解析
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ResultModel<T> : Result_Model
    {
        public T ResultData { get; set; }
        public ResultModel(int _status, string _message)
        {
            this.Status = _status;
            this.Message = _message;
        }
        public ResultModel(int _status, string _message, T resultData)
        {
            this.Status = _status;
            this.Message = _message;
            this.ResultData = resultData;
        }
        public ResultModel(int _status, string _message, T resultData, object _data)
        {
            this.Status = _status;
            this.Message = _message;
            this.ResultData = resultData;
            this.Data = _data;
        }
    }
}
